
package com.idealighter.game.bank.manager;

import com.google.inject.Singleton;

import com.idealighter.game.bank.convert.BankConvert;
import com.idealighter.game.bank.dto.TranferRecordDto;
import com.idealighter.game.bank.message.ResTransferCountMsg;
import com.idealighter.game.bank.message.ResTransferGoldRecordMsg;
import com.idealighter.game.bank.message.ResTransferGoldSuccessMsg;
import com.idealighter.game.server.db.datadb.generate.domain.TransferGoldRecordDomain;

import java.util.List;

/**
 * 银行消息管理 .
 * 
 * @date 2016年1月15日 下午4:11:26
 *
 */
@Singleton
public class BankMsgMgr {
  // @Inject
  // private PlayerMsgWriter msgWriter;

  /**
   * 发送转账成功消息(客户端有逻辑处理) .
   * 
   * @param record 转账记录.
   */
  public ResTransferGoldSuccessMsg sendTransferGoldSuccessMsg(TransferGoldRecordDomain record) {
    ResTransferGoldSuccessMsg msg = new ResTransferGoldSuccessMsg();
    TranferRecordDto dto = BankConvert.INSTANCE.toTransferRecordDto(record);
    msg.setResult(dto);
    return msg;
  }

  /**
   * 发送转账列表.
   * 
   * @param records 玩家列表.
   */
  public ResTransferGoldRecordMsg sendTransferRecordsMsg(List<TransferGoldRecordDomain> records,
      long total, boolean hasNext) {
    ResTransferGoldRecordMsg msg = new ResTransferGoldRecordMsg();
    List<TranferRecordDto> dtos = BankConvert.INSTANCE.toTransferRecordDtos(records);
    msg.setRecords(dtos);
    msg.setTotal(total);
    msg.setHasNext(hasNext);
    return msg;
  }

  /**
   * 发送转账统计-通知.
   * 
   * @param outToAgent 今日转出到代理.
   * @param outToUser 今日转出到玩家.
   * @param inFromAgent 今日代理转入.
   * @param inFromUser 今日玩家转入.
   */
  public ResTransferCountMsg sendTransferCountMsg(long outToAgent, long outToUser, long inFromAgent,
      long inFromUser) {
    ResTransferCountMsg msg = new ResTransferCountMsg();
    msg.setInFromAgent(inFromAgent);
    msg.setInFromUser(inFromUser);
    msg.setOutToAgent(outToAgent);
    msg.setOutToUser(outToUser);
    return msg;
  }

  // public void sendDepositeGoldSuccessMsg(Player player) {
  // ResDepositeGoldMsg msg = new ResDepositeGoldMsg();
  // msgWriter.writeMsg(player, msg);
  // }
  //
  // public void sendWithdrawGoldSuccessMsg(Player player) {
  // ResWithdrawGoldMsg msg = new ResWithdrawGoldMsg();
  // msgWriter.writeMsg(player, msg);
  // }
  //
  // public void sendTransferRewardSuccessMsg(Player player) {
  // ResTranferRewardMsg msg = new ResTranferRewardMsg();
  // msgWriter.writeMsg(player, msg);
  // }

}
